/*
 *
 *    Copyright (c) 2022 Project CHIP Authors
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

// THIS FILE IS GENERATED BY ZAP
// This file is generated from clusters-Commands.ipp.zapt

#include <clusters/UnitTesting/Commands.h>

#include <app/data-model/Decode.h>
#include <app/data-model/StructDecodeIterator.h>
#include <app/data-model/WrappedStructEncoder.h>

namespace chip {
namespace app {
namespace Clusters {
namespace UnitTesting {
namespace Commands {
namespace Test {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        ReturnErrorOnFailure(err);
    }
}
} // namespace Test.
namespace TestSpecificResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kReturnValue), returnValue);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kReturnValue))
        {
            err = DataModel::Decode(reader, returnValue);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestSpecificResponse.
namespace TestNotHandled {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestNotHandled.
namespace TestAddArgumentsResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kReturnValue), returnValue);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kReturnValue))
        {
            err = DataModel::Decode(reader, returnValue);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestAddArgumentsResponse.
namespace TestSpecific {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestSpecific.
namespace TestSimpleArgumentResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kReturnValue), returnValue);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kReturnValue))
        {
            err = DataModel::Decode(reader, returnValue);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestSimpleArgumentResponse.
namespace TestUnknownCommand {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestUnknownCommand.
namespace TestStructArrayArgumentResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    encoder.Encode(to_underlying(Fields::kArg2), arg2);
    encoder.Encode(to_underlying(Fields::kArg3), arg3);
    encoder.Encode(to_underlying(Fields::kArg4), arg4);
    encoder.Encode(to_underlying(Fields::kArg5), arg5);
    encoder.Encode(to_underlying(Fields::kArg6), arg6);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }
        else if (__context_tag == to_underlying(Fields::kArg2))
        {
            err = DataModel::Decode(reader, arg2);
        }
        else if (__context_tag == to_underlying(Fields::kArg3))
        {
            err = DataModel::Decode(reader, arg3);
        }
        else if (__context_tag == to_underlying(Fields::kArg4))
        {
            err = DataModel::Decode(reader, arg4);
        }
        else if (__context_tag == to_underlying(Fields::kArg5))
        {
            err = DataModel::Decode(reader, arg5);
        }
        else if (__context_tag == to_underlying(Fields::kArg6))
        {
            err = DataModel::Decode(reader, arg6);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestStructArrayArgumentResponse.
namespace TestAddArguments {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    encoder.Encode(to_underlying(Fields::kArg2), arg2);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }
        else if (__context_tag == to_underlying(Fields::kArg2))
        {
            err = DataModel::Decode(reader, arg2);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestAddArguments.
namespace TestListInt8UReverseResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestListInt8UReverseResponse.
namespace TestSimpleArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestSimpleArgumentRequest.
namespace TestEnumsResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    encoder.Encode(to_underlying(Fields::kArg2), arg2);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }
        else if (__context_tag == to_underlying(Fields::kArg2))
        {
            err = DataModel::Decode(reader, arg2);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestEnumsResponse.
namespace TestStructArrayArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    encoder.Encode(to_underlying(Fields::kArg2), arg2);
    encoder.Encode(to_underlying(Fields::kArg3), arg3);
    encoder.Encode(to_underlying(Fields::kArg4), arg4);
    encoder.Encode(to_underlying(Fields::kArg5), arg5);
    encoder.Encode(to_underlying(Fields::kArg6), arg6);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }
        else if (__context_tag == to_underlying(Fields::kArg2))
        {
            err = DataModel::Decode(reader, arg2);
        }
        else if (__context_tag == to_underlying(Fields::kArg3))
        {
            err = DataModel::Decode(reader, arg3);
        }
        else if (__context_tag == to_underlying(Fields::kArg4))
        {
            err = DataModel::Decode(reader, arg4);
        }
        else if (__context_tag == to_underlying(Fields::kArg5))
        {
            err = DataModel::Decode(reader, arg5);
        }
        else if (__context_tag == to_underlying(Fields::kArg6))
        {
            err = DataModel::Decode(reader, arg6);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestStructArrayArgumentRequest.
namespace TestNullableOptionalResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kWasPresent), wasPresent);
    encoder.Encode(to_underlying(Fields::kWasNull), wasNull);
    encoder.Encode(to_underlying(Fields::kValue), value);
    encoder.Encode(to_underlying(Fields::kOriginalValue), originalValue);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kWasPresent))
        {
            err = DataModel::Decode(reader, wasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kWasNull))
        {
            err = DataModel::Decode(reader, wasNull);
        }
        else if (__context_tag == to_underlying(Fields::kValue))
        {
            err = DataModel::Decode(reader, value);
        }
        else if (__context_tag == to_underlying(Fields::kOriginalValue))
        {
            err = DataModel::Decode(reader, originalValue);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestNullableOptionalResponse.
namespace TestStructArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestStructArgumentRequest.
namespace TestComplexNullableOptionalResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNullableIntWasNull), nullableIntWasNull);
    encoder.Encode(to_underlying(Fields::kNullableIntValue), nullableIntValue);
    encoder.Encode(to_underlying(Fields::kOptionalIntWasPresent), optionalIntWasPresent);
    encoder.Encode(to_underlying(Fields::kOptionalIntValue), optionalIntValue);
    encoder.Encode(to_underlying(Fields::kNullableOptionalIntWasPresent), nullableOptionalIntWasPresent);
    encoder.Encode(to_underlying(Fields::kNullableOptionalIntWasNull), nullableOptionalIntWasNull);
    encoder.Encode(to_underlying(Fields::kNullableOptionalIntValue), nullableOptionalIntValue);
    encoder.Encode(to_underlying(Fields::kNullableStringWasNull), nullableStringWasNull);
    encoder.Encode(to_underlying(Fields::kNullableStringValue), nullableStringValue);
    encoder.Encode(to_underlying(Fields::kOptionalStringWasPresent), optionalStringWasPresent);
    encoder.Encode(to_underlying(Fields::kOptionalStringValue), optionalStringValue);
    encoder.Encode(to_underlying(Fields::kNullableOptionalStringWasPresent), nullableOptionalStringWasPresent);
    encoder.Encode(to_underlying(Fields::kNullableOptionalStringWasNull), nullableOptionalStringWasNull);
    encoder.Encode(to_underlying(Fields::kNullableOptionalStringValue), nullableOptionalStringValue);
    encoder.Encode(to_underlying(Fields::kNullableStructWasNull), nullableStructWasNull);
    encoder.Encode(to_underlying(Fields::kNullableStructValue), nullableStructValue);
    encoder.Encode(to_underlying(Fields::kOptionalStructWasPresent), optionalStructWasPresent);
    encoder.Encode(to_underlying(Fields::kOptionalStructValue), optionalStructValue);
    encoder.Encode(to_underlying(Fields::kNullableOptionalStructWasPresent), nullableOptionalStructWasPresent);
    encoder.Encode(to_underlying(Fields::kNullableOptionalStructWasNull), nullableOptionalStructWasNull);
    encoder.Encode(to_underlying(Fields::kNullableOptionalStructValue), nullableOptionalStructValue);
    encoder.Encode(to_underlying(Fields::kNullableListWasNull), nullableListWasNull);
    encoder.Encode(to_underlying(Fields::kNullableListValue), nullableListValue);
    encoder.Encode(to_underlying(Fields::kOptionalListWasPresent), optionalListWasPresent);
    encoder.Encode(to_underlying(Fields::kOptionalListValue), optionalListValue);
    encoder.Encode(to_underlying(Fields::kNullableOptionalListWasPresent), nullableOptionalListWasPresent);
    encoder.Encode(to_underlying(Fields::kNullableOptionalListWasNull), nullableOptionalListWasNull);
    encoder.Encode(to_underlying(Fields::kNullableOptionalListValue), nullableOptionalListValue);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNullableIntWasNull))
        {
            err = DataModel::Decode(reader, nullableIntWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableIntValue))
        {
            err = DataModel::Decode(reader, nullableIntValue);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalIntWasPresent))
        {
            err = DataModel::Decode(reader, optionalIntWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalIntValue))
        {
            err = DataModel::Decode(reader, optionalIntValue);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalIntWasPresent))
        {
            err = DataModel::Decode(reader, nullableOptionalIntWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalIntWasNull))
        {
            err = DataModel::Decode(reader, nullableOptionalIntWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalIntValue))
        {
            err = DataModel::Decode(reader, nullableOptionalIntValue);
        }
        else if (__context_tag == to_underlying(Fields::kNullableStringWasNull))
        {
            err = DataModel::Decode(reader, nullableStringWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableStringValue))
        {
            err = DataModel::Decode(reader, nullableStringValue);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalStringWasPresent))
        {
            err = DataModel::Decode(reader, optionalStringWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalStringValue))
        {
            err = DataModel::Decode(reader, optionalStringValue);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalStringWasPresent))
        {
            err = DataModel::Decode(reader, nullableOptionalStringWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalStringWasNull))
        {
            err = DataModel::Decode(reader, nullableOptionalStringWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalStringValue))
        {
            err = DataModel::Decode(reader, nullableOptionalStringValue);
        }
        else if (__context_tag == to_underlying(Fields::kNullableStructWasNull))
        {
            err = DataModel::Decode(reader, nullableStructWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableStructValue))
        {
            err = DataModel::Decode(reader, nullableStructValue);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalStructWasPresent))
        {
            err = DataModel::Decode(reader, optionalStructWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalStructValue))
        {
            err = DataModel::Decode(reader, optionalStructValue);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalStructWasPresent))
        {
            err = DataModel::Decode(reader, nullableOptionalStructWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalStructWasNull))
        {
            err = DataModel::Decode(reader, nullableOptionalStructWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalStructValue))
        {
            err = DataModel::Decode(reader, nullableOptionalStructValue);
        }
        else if (__context_tag == to_underlying(Fields::kNullableListWasNull))
        {
            err = DataModel::Decode(reader, nullableListWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableListValue))
        {
            err = DataModel::Decode(reader, nullableListValue);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalListWasPresent))
        {
            err = DataModel::Decode(reader, optionalListWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalListValue))
        {
            err = DataModel::Decode(reader, optionalListValue);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalListWasPresent))
        {
            err = DataModel::Decode(reader, nullableOptionalListWasPresent);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalListWasNull))
        {
            err = DataModel::Decode(reader, nullableOptionalListWasNull);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalListValue))
        {
            err = DataModel::Decode(reader, nullableOptionalListValue);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestComplexNullableOptionalResponse.
namespace TestNestedStructArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestNestedStructArgumentRequest.
namespace BooleanResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kValue), value);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kValue))
        {
            err = DataModel::Decode(reader, value);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace BooleanResponse.
namespace TestListStructArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestListStructArgumentRequest.
namespace SimpleStructResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace SimpleStructResponse.
namespace TestListInt8UArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestListInt8UArgumentRequest.
namespace TestEmitTestEventResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kValue), value);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kValue))
        {
            err = DataModel::Decode(reader, value);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestEmitTestEventResponse.
namespace TestNestedStructListArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestNestedStructListArgumentRequest.
namespace TestEmitTestFabricScopedEventResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kValue), value);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kValue))
        {
            err = DataModel::Decode(reader, value);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestEmitTestFabricScopedEventResponse.
namespace TestListNestedStructListArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestListNestedStructListArgumentRequest.
namespace TestBatchHelperResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kBuffer), buffer);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kBuffer))
        {
            err = DataModel::Decode(reader, buffer);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestBatchHelperResponse.
namespace TestListInt8UReverseRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestListInt8UReverseRequest.
namespace StringEchoResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kPayload), payload);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kPayload))
        {
            err = DataModel::Decode(reader, payload);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace StringEchoResponse.
namespace TestEnumsRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    encoder.Encode(to_underlying(Fields::kArg2), arg2);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }
        else if (__context_tag == to_underlying(Fields::kArg2))
        {
            err = DataModel::Decode(reader, arg2);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestEnumsRequest.
namespace GlobalEchoResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kField1), field1);
    encoder.Encode(to_underlying(Fields::kField2), field2);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kField1))
        {
            err = DataModel::Decode(reader, field1);
        }
        else if (__context_tag == to_underlying(Fields::kField2))
        {
            err = DataModel::Decode(reader, field2);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace GlobalEchoResponse.
namespace TestNullableOptionalRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestNullableOptionalRequest.
namespace TestComplexNullableOptionalRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNullableInt), nullableInt);
    encoder.Encode(to_underlying(Fields::kOptionalInt), optionalInt);
    encoder.Encode(to_underlying(Fields::kNullableOptionalInt), nullableOptionalInt);
    encoder.Encode(to_underlying(Fields::kNullableString), nullableString);
    encoder.Encode(to_underlying(Fields::kOptionalString), optionalString);
    encoder.Encode(to_underlying(Fields::kNullableOptionalString), nullableOptionalString);
    encoder.Encode(to_underlying(Fields::kNullableStruct), nullableStruct);
    encoder.Encode(to_underlying(Fields::kOptionalStruct), optionalStruct);
    encoder.Encode(to_underlying(Fields::kNullableOptionalStruct), nullableOptionalStruct);
    encoder.Encode(to_underlying(Fields::kNullableList), nullableList);
    encoder.Encode(to_underlying(Fields::kOptionalList), optionalList);
    encoder.Encode(to_underlying(Fields::kNullableOptionalList), nullableOptionalList);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNullableInt))
        {
            err = DataModel::Decode(reader, nullableInt);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalInt))
        {
            err = DataModel::Decode(reader, optionalInt);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalInt))
        {
            err = DataModel::Decode(reader, nullableOptionalInt);
        }
        else if (__context_tag == to_underlying(Fields::kNullableString))
        {
            err = DataModel::Decode(reader, nullableString);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalString))
        {
            err = DataModel::Decode(reader, optionalString);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalString))
        {
            err = DataModel::Decode(reader, nullableOptionalString);
        }
        else if (__context_tag == to_underlying(Fields::kNullableStruct))
        {
            err = DataModel::Decode(reader, nullableStruct);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalStruct))
        {
            err = DataModel::Decode(reader, optionalStruct);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalStruct))
        {
            err = DataModel::Decode(reader, nullableOptionalStruct);
        }
        else if (__context_tag == to_underlying(Fields::kNullableList))
        {
            err = DataModel::Decode(reader, nullableList);
        }
        else if (__context_tag == to_underlying(Fields::kOptionalList))
        {
            err = DataModel::Decode(reader, optionalList);
        }
        else if (__context_tag == to_underlying(Fields::kNullableOptionalList))
        {
            err = DataModel::Decode(reader, nullableOptionalList);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestComplexNullableOptionalRequest.
namespace SimpleStructEchoRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace SimpleStructEchoRequest.
namespace TimedInvokeRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        ReturnErrorOnFailure(err);
    }
}
} // namespace TimedInvokeRequest.
namespace TestSimpleOptionalArgumentRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestSimpleOptionalArgumentRequest.
namespace TestEmitTestEventRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    encoder.Encode(to_underlying(Fields::kArg2), arg2);
    encoder.Encode(to_underlying(Fields::kArg3), arg3);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }
        else if (__context_tag == to_underlying(Fields::kArg2))
        {
            err = DataModel::Decode(reader, arg2);
        }
        else if (__context_tag == to_underlying(Fields::kArg3))
        {
            err = DataModel::Decode(reader, arg3);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestEmitTestEventRequest.
namespace TestEmitTestFabricScopedEventRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestEmitTestFabricScopedEventRequest.
namespace TestBatchHelperRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kSleepBeforeResponseTimeMs), sleepBeforeResponseTimeMs);
    encoder.Encode(to_underlying(Fields::kSizeOfResponseBuffer), sizeOfResponseBuffer);
    encoder.Encode(to_underlying(Fields::kFillCharacter), fillCharacter);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kSleepBeforeResponseTimeMs))
        {
            err = DataModel::Decode(reader, sleepBeforeResponseTimeMs);
        }
        else if (__context_tag == to_underlying(Fields::kSizeOfResponseBuffer))
        {
            err = DataModel::Decode(reader, sizeOfResponseBuffer);
        }
        else if (__context_tag == to_underlying(Fields::kFillCharacter))
        {
            err = DataModel::Decode(reader, fillCharacter);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestBatchHelperRequest.
namespace TestSecondBatchHelperRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kSleepBeforeResponseTimeMs), sleepBeforeResponseTimeMs);
    encoder.Encode(to_underlying(Fields::kSizeOfResponseBuffer), sizeOfResponseBuffer);
    encoder.Encode(to_underlying(Fields::kFillCharacter), fillCharacter);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kSleepBeforeResponseTimeMs))
        {
            err = DataModel::Decode(reader, sleepBeforeResponseTimeMs);
        }
        else if (__context_tag == to_underlying(Fields::kSizeOfResponseBuffer))
        {
            err = DataModel::Decode(reader, sizeOfResponseBuffer);
        }
        else if (__context_tag == to_underlying(Fields::kFillCharacter))
        {
            err = DataModel::Decode(reader, fillCharacter);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestSecondBatchHelperRequest.
namespace StringEchoRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kPayload), payload);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kPayload))
        {
            err = DataModel::Decode(reader, payload);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace StringEchoRequest.
namespace GlobalEchoRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kField1), field1);
    encoder.Encode(to_underlying(Fields::kField2), field2);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kField1))
        {
            err = DataModel::Decode(reader, field1);
        }
        else if (__context_tag == to_underlying(Fields::kField2))
        {
            err = DataModel::Decode(reader, field2);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace GlobalEchoRequest.
namespace TestCheckCommandFlags {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestCheckCommandFlags.
namespace TestDifferentVendorMeiRequest {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestDifferentVendorMeiRequest.
namespace TestDifferentVendorMeiResponse {

CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kArg1), arg1);
    encoder.Encode(to_underlying(Fields::kEventNumber), eventNumber);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kArg1))
        {
            err = DataModel::Decode(reader, arg1);
        }
        else if (__context_tag == to_underlying(Fields::kEventNumber))
        {
            err = DataModel::Decode(reader, eventNumber);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace TestDifferentVendorMeiResponse.
} // namespace Commands
} // namespace UnitTesting
} // namespace Clusters
} // namespace app
} // namespace chip
